package com.jumper.mydemo.statics;

import java.util.Map;

import org.springframework.core.type.AnnotationMetadata;
import org.springframework.stereotype.Component;

import com.jumper.mydemo.my.MyBean;

public class MeatdataReflectDemo {
    public static void run() {
        AnnotationMetadata annotationMetadata = AnnotationMetadata.introspect(MyBean.class);
		System.out.println("AnnotationMetadata Impl class is " + annotationMetadata.getClass());

		boolean isComponent = annotationMetadata.hasAnnotation(Component.class.getName());
		System.out.println("MyBean is a @component " + isComponent);

		if (isComponent) {
			Map<String, Object> annotationAttributes = annotationMetadata.getAnnotationAttributes(Component.class.getName());
			System.out.println("@Compoent value is " + annotationAttributes.get("value"));
		}
    }
}
